<meta charset=utf-8>

<?php
      $id = $_GET['id'];

  	if(!empty($_POST)){

  $name = $_POST['name'];

  $cellphone = $_POST['cellphone'];

  $sex = $_POST['sex'];

  $age = $_POST['age'];

  $name = $_POST['name'];

   $sql = "update `admin` set `name`='$name',`cellphone`='$cellphone',`sex`='$sex',`age`='$age',`name`='$name' where `id`='$id'";

      mysqli_query($link,$sql);

      $row=mysqli_affected_rows($link);

   if($row>=0){
        echo '<script>alert("修改成功");location.href="index.php?c=admin&&a=list&&admin=1"; </script>';
   }else {
   	 echo '<script>alert("修改失败");history.go(-1) </script>';
   }


  	}




    $sql = "select * from `admin` where id=$id";

 	 $result = mysqli_query($link,$sql);

 	 $data = mysqli_fetch_assoc($result);


// print_r($data);die;

 //载入后台公共视图
    include_once (VIEW_PATH.'admin/layout.html');

?>